﻿@model WaiGaoQiaoWeb.Models.BackOfCardVM
@{
    ViewBag.Title = "BackOfCard";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section Head
{
    @Html.Css("EditForm")
    <script type="text/javascript" language="javascript">
        $(document).ready(function () {
            $("form").makeValidationInline();
            //保存
            $("#btnSave").click(function (event) {
                var vbalance = $("#Balance").val();
                $.ajax({
                    type: "POST",
                    url: '@Url.Action("CheckBalance", "BackOfCard")',
                    data: { sel: vbalance },
                    dataType: "json",
                    success: function (msg) {
                        if (msg == false) {
                            showLoadingMsg("卡内余额不能大于0", { left: 200, top: 50 }, true, 3000);
                            return false;
                        }
                        else {
                            if (!$("#fmEdit").valid()) {
                                return false;
                            }
                            $('#fmEdit').ajaxSubmit(function (callback) {
                                if (callback) {
                                    CloseModelWindow(null, true);
                                }
                            });
                        }
                    }
                });

            });
            //关闭
            $("#btnCancel").click(function (e) {
                CloseModelWindow(null, false);
            });
        });              // end of document
        function updateAvailable() {
            var a1 = document.getElementById("tab3").value;
            var a2 = document.getElementById("tab1").value;
            var a3 = a1 - a2;
            document.getElementById("tab2").value = a3;
        }    
    </script>
}
@using (Html.BeginForm("SaveBackOfCard", "BackOfCard", FormMethod.Post, new { id = "fmEdit" }))
{
    @Html.ValidationSummary(true)
    <div id="editFormWrapper">
        @Html.HiddenFor(model => model.EmpNo)
        <fieldset>
            <legend>卡信息</legend>
            <div class="editFormItems">
                <div class="editFormLabel">
                    @Html.LabelFor(model => model.LOGOUTTYPE)
                </div>
                <div class="editForm">
                    @Html.DropDownListFor(model => model.LOGOUTTYPE,
             ViewData["LOGOUTTYPE"] as IEnumerable<SelectListItem>,
                                 new { @style = "width:130px; height:22px; font-size:13px;" })
                </div>
            </div>
            <div class="editFormItems">
                <div class="editFormLabel">
                    @Html.LabelFor(model => model.PersonTypeName)
                </div>
                <div class="editForm">
                    @Html.TextBoxFor(model => model.PersonTypeName, new { @readonly = true, disabled = "disabled" })
                    @Html.ValidationMessageFor(model => model.PersonTypeName)
                </div>
            </div>
            <div class="editFormItems">
                <div class="editFormLabel">
                    @Html.LabelFor(model => model.deptName)
                </div>
                <div class="editForm">
                    @Html.TextBoxFor(model => model.deptName, new { @readonly = true, disabled = "disabled" })
                    @Html.ValidationMessageFor(model => model.deptName)
                </div>
            </div>
            <div class="editFormItems">
                <div class="editFormLabel">
                    @Html.LabelFor(model => model.CardSerial)
                </div>
                <div class="editForm">
                    @Html.TextBoxFor(model => model.CardSerial, new { @readonly = true, disabled = "disabled" })
                    @Html.ValidationMessageFor(model => model.CardSerial)
                </div>
            </div>
            <div class="editFormItems">
                <div class="editFormLabel">
                    @Html.LabelFor(model => model.Status)
                </div>
                <div class="editForm">
                    @Html.TextBoxFor(model => model.Status, new { @readonly = true, disabled = "disabled" })
                    @Html.ValidationMessageFor(model => model.Status)
                </div>
            </div>
            <div class="editFormItems">
                <div class="editFormLabel">
                    @Html.LabelFor(model => model.WorkStatus)
                </div>
                <div class="editForm">
                    @Html.TextBoxFor(model => model.WorkStatus, new { @readonly = true, disabled = "disabled" })
                    @Html.ValidationMessageFor(model => model.WorkStatus)
                </div>
            </div>
            <div class="editFormItems">
                <div class="editFormLabel">
                    @Html.LabelFor(model => model.Balance)
                </div>
                <div class="editForm">
                    @Html.TextBoxFor(model => model.Balance, new { @readonly = true })
                    @Html.ValidationMessageFor(model => model.Balance)
                </div>
            </div>
            <div class="editFormItems">
                <div class="editFormLabel">
                    @Html.LabelFor(model => model.CardOptDeposit)
                </div>
                <div class="editForm">
                    @Html.TextBoxFor(model => model.CardOptDeposit, new { @readonly = true, id = "tab3", disabled = "disabled" })
                    @Html.ValidationMessageFor(model => model.CardOptDeposit)
                </div>
            </div>
        </fieldset>
        <fieldset>
            <legend>退卡信息</legend>
            <div class="editFormItems">
                <div class="editFormLabel">
                    @Html.LabelFor(model => model.BalanceBack)
                </div>
                <div class="editForm">
                    @Html.TextBoxFor(model => model.BalanceBack, new { @readonly = true, disabled = "disabled" })
                    @Html.ValidationMessageFor(model => model.BalanceBack)
                </div>
            </div>
            <div class="editFormItems">
                <div class="editFormLabel">
                    @Html.LabelFor(model => model.OldMoney)
                </div>
                <div class="editForm">
                    @Html.TextBoxFor(model => model.OldMoney, new { onblur = "updateAvailable()", id = "tab1", Class = "uc", disabled = "disabled" })
                    @Html.ValidationMessageFor(model => model.OldMoney)
                </div>
            </div>
            <div class="editFormItems">
                <div class="editFormLabel">
                    @Html.LabelFor(model => model.CardOptDepositBack)
                </div>
                <div class="editForm">
                    @Html.TextBoxFor(model => model.CardOptDepositBack, new { @readonly = true, id = "tab2", disabled = "disabled" })
                    @Html.ValidationMessageFor(model => model.CardOptDepositBack)
                </div>
            </div>
        </fieldset>
    </div>
    <div class="buttonpanel">
        <div style="float: right; margin-right: 10px;">
            <a id="btnSave" href="javascript:void(0);" class="button"><span>保存</span></a> <a
                id="btnCancel" href="javascript:void(0);" class="button"><span>关闭</span></a>
        </div>
    </div>
     
}
